import { fromJS } from 'immutable';
import reducerHandler from 'shared/utils/reducerHandler';

const initialState = fromJS({
  isAuthenticated: false,
  userData: {},
});

const handlers = {
  ['FETCH_USER'](state, { payload }) {
    return state
      .set('userData', payload)
      .set('isAuthenticated', true);
  }
};

export default reducerHandler(initialState, handlers);
